package com.scope;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;

/**
 * @author Xiongx
 * @version 1.0
 * @date 2021/6/28 4:30
 * @since JDK 1.8
 */
@Component
@Scope("prototype")
public class ScopeUtils {

    @Bean
    @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.TARGET_CLASS)
    public ScopeBean getTestBean() {
        System.out.println("我执行了1111111111111111");
        return new ScopeBean();
    }

    @Bean
    public ScopeBean getTestBean2(){
        System.out.println("hahaa");
        return new ScopeBean();
    }
}
